import request from '@/utils/request'


export function login(username, password) {
  //console.log(  " login 123 username--->"+username)
  //console.log( " login 123  password--->"+password)

  return request({
    url: '/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/logout',
    method: 'post'
  })
}


export function getPicList(  pageNum) {
  return request({
    url: '/getPicList',
    method: 'get',
    params: {  pageNum }
  })
}


export function getBlogList(  pageSize , pageNum) {
  return request({
    url: '/getBlogList',
    method: 'get',
    params: { pageSize , pageNum }
  })
}




export function articleAddToServer(articleTitle , isVisable ,articleType ,articleContent) {
  return request({
    url: '/articleAdd',
    method: 'post',
    data: {
      articleTitle ,
      isVisable ,
      articleType ,
      articleContent
    }
  })
}


export function articleUpdateById(articleTitle , isVisable ,articleType ,articleContent ,blogId) {
  return request({
    url: '/articleUpdateById',
    method: 'post',
    data: {
      articleTitle ,
      isVisable ,
      articleType ,
      articleContent,
      blogId
    }
  })
}



export function deleteBlogById( blogId) {
  return request({
    url: '/deleteBlogById',
    method: 'get',
    params: { blogId  }
  })
}


export function getBlogContentById( blogId) {
  return request({
    url: '/getBlogContentById',
    method: 'get',
    params: {   blogId }
  })
}
